package com.wtx.atguigu.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * @description: 调用api拷贝
 * @author: wtx
 * @createDate: 2020/6/8
 */
public class NioFileChannel04 {
    public static void main(String[] args) throws IOException {

        FileInputStream fileInputStream = new FileInputStream("file01.txt");
        FileOutputStream fileOutputStream = new FileOutputStream("file03.txt");

        FileChannel source = fileInputStream.getChannel();
        FileChannel destination = fileOutputStream.getChannel();

        destination.transferFrom(source,0,source.size());

        fileInputStream.close();
        fileOutputStream.close();
    }
}
